package com.fsy.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fsy.entities.Userroles;
import com.fsy.service.UserrolesService;
import com.fsy.mapper.UserrolesMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
* @author 凡凡
* @description 针对表【userroles】的数据库操作Service实现
* @createDate 2022-04-17 20:38:33
*/
@Service
public class UserrolesServiceImpl extends ServiceImpl<UserrolesMapper, Userroles>
    implements UserrolesService{
    @Resource
    private UserrolesMapper userrolesMapper;


    /**
     * 查询用户有什么角色
     * @param id
     * @return
     */
   public List<Userroles> selectUserrolesById(Integer id){
        return userrolesMapper.selectUserrolesById(id);
    }

    /**
     * 删除用户角色
     * @param userId
     * @param roleId
     * @return
     */
    public int deleteUserrolesById(Integer userId,Integer roleId){
        return userrolesMapper.deleteUserrolesById(userId,roleId);
    }

    @Override
    public List<Userroles> selectUserAndUserrolesAndRolesById(Integer id) {
        return userrolesMapper.selectUserAndUserrolesAndRolesById(id);
    }

}




